home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TGCBOR20.ARJ / INTROPAK.COM / SPAWNTST.C < prev    next >
Text File  |  1991-05-29  |  2KB  |  111 lines

  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <errno.h>
  5. #include <process.h>
  6. #include <string.h>
  7.  
  8. #include <teglsys.h>
  9. #ifdef TURBOC
  10. #include <alloc.h>
  11. #include <dir.h>
  12. #endif
  13.  
  14. #ifdef QUICKC
  15. #include <malloc.h>
  16. #include <direct.h>
  17. #endif
  18.  
  19. optionmptr  om1;
  20.  
  21. unsigned dospawn(imagestkptr frame,msclickptr mouseclickpos)
  22. {
  23.   if (visualbuttonpress(frame, mouseclickpos)) {
  24.      hidemouse();
  25.      pushimage(0,0,getmaxx(),getmaxy());
  26.      setkeyboardmouse(FALSE);
  27.      swapteglintroff();
  28.      restorecrtmode();
  29.  
  30.      do_exec("", "", 1, 0xffff, NULL);
  31.  
  32.      initvideomode(activeteglmode->modenumber);
  33.      swapteglintron();
  34.      setmouseposition(430,230);
  35.      setkeyboardmouse(TRUE);
  36.      popimage();
  37.      showmouse();
  38.      releasebutton(frame,mouseclickpos);
  39.   }
  40.  
  41.   return 1;
  42. }
  43.  
  44. unsigned easyquit(imagestkptr frame,msclickptr mouseclickpos)
  45. {
  46.     seteasyfont(font14);
  47.     if (getyesno(100,50,"Are you sure"))
  48.        abortexit("Bye....");
  49.  
  50.     return 1;
  51. }
  52.  
  53. unsigned infooption(imagestkptr ifs, msclickptr ms)
  54. {
  55.     imagestkptr fs;
  56.     unsigned x=100,y=100,w=370,h=100;
  57.  
  58.     hidemouse();
  59.     quickframe(&fs,&x,&y,&w,&h);
  60.  
  61.     setcolor(BLACK);
  62.     frametext(fs,1,2,"Simple program to test spawn capability.");
  63.     definebuttonclick(fs,x+300,y+70,imageOK,NULL);
  64.     showmouse();
  65.  
  66.     while (checkformouseselect(fs) == NULL);
  67.  
  68.     dropstackimage(fs);
  69.  
  70.     return 1;
  71. }
  72.  
  73.  
  74.  
  75. void main(void)
  76. {
  77.  
  78. /*  Optional Startup. Forcing a Video Mode              */
  79. /*  Note: Use either easytegl() or teglinit(). NOT both       */
  80. /*      For autodection use teglinit(videoautodetect(),32768l); */
  81. /*
  82.     registertgidriver(GREVGA16_driver);
  83.     registertgidriver(GRCGABW_driver);
  84.     registertgidriver(GRVGA256_driver);
  85.     registertgidriver(GRHERCBW_driver);
  86.  
  87.     setstandardheapsize(20000l); /* Reserve about 20k for Video Drivers */
  88.     teglinit("SVGA1024x768x256",32768l);
  89.     clearteglscreen();
  90. */
  91.  
  92.     easytegl();
  93.     easyout();
  94.     setctrlbreakfs(easyquit);
  95.  
  96.     setteglfont(font14);
  97.     setoptionmenucolors(BLACK,CYAN);
  98.     om1 = createoptionmenu(font14);
  99.     defineoptions(om1," Info... ", TRUE, infooption);
  100.     defineoptions(om1,"--",     FALSE, NULL);
  101.     defineoptions(om1," Quit ", TRUE, easyquit);
  102.  
  103.     createbarmenu(0,0,getmaxx());
  104.     outbaroption(" File ",om1);
  105.  
  106.     activebutton(440,190," SPAWN  ",dospawn);
  107.  
  108.     teglsupervisor();
  109. }
  110.  
  111.